package actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import forms.DegreeForm;

public class DegreeInfoAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		
		String discipline = (String)request.getParameter("discipline");
		String month = (String)request.getParameter("month");
		String year = (String)request.getParameter("year");
		String gpa = (String)request.getParameter("gpa");
		String title = (String)request.getParameter("title");
		
		DegreeForm iForm = (DegreeForm) form;
		
		iForm.setDiscipline(discipline);
		iForm.setMonth(month);
		iForm.setYear(year);
		iForm.setGpa(gpa);
		iForm.setTitle(title);
		
		request.setAttribute("degrees", iForm.getDegrees());

    	return mapping.findForward("success");
	}
}
